package chapter12.exception_;

import java.io.FileInputStream;
import java.io.FileNotFoundException;

/**
 * @Auther: Tx
 * @Date: 2022/5/10 15:02
 */
public class ThrowsDetail {
    public static void main(String[] args) {

    }

    public static void function1() {
        int n1 = 10;
        int n2 = 0;
        double res = n1 / n2;
    }

    public static void function2() throws FileNotFoundException {
        function3();
    }

    public static void function3() throws FileNotFoundException {
        FileInputStream file = new FileInputStream("d://aa.txt");
    }

    public static void function4() {

        function5();
          //这里调用function5就不需要显式处理
         //因为ArithmeticException是运行时异常，有默认处理机制
        // JVM的处理方式就是将异常打印，然后退出。
    }

    public static void function5() throws ArithmeticException {

    }

}
class Father{
    public void method() throws RuntimeException{

    }
}
class Son extends Father{
    @Override
    public void method() throws ArithmeticException {
    }
}